All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.awt.Component
The Component
class is the abstract superclass of
the nonmenu-related Abstract Window Toolkit components. Class
Component
can also be extended directly to create a
lightweight component. A lightweight component is a component that is
not associated with a native opaque window.
getAlignmentY
.
getAlignmentY
and
getAlignmentX()
.
getAlignmentX
.
getAlignmentX
.
getAlignmentY
.
x
and y
are defined to be
relative to the coordinate system of this component.
Rectangle
object.
ColorModel
used to display
the component on the output device.
Dimension
object.
System.out
.
ComponentListener
objects.
FocusListener
objects.
MouseListener
objects.
MouseMotionListener
objects.
tm
milliseconds.
r
.
b
.
d.width
and height d.height
.
width
and height
.
b
.
public static final float TOP_ALIGNMENT
getAlignmentY()
. Specifies an
alignment to the top of the component.
public static final float CENTER_ALIGNMENT
getAlignmentY
and
getAlignmentX
. Specifies an alignment to
the center of the component
public static final float BOTTOM_ALIGNMENT
getAlignmentY
. Specifies an
alignment to the bottom of the component.
public static final float LEFT_ALIGNMENT
getAlignmentX
. Specifies an
alignment to the left side of the component.
public static final float RIGHT_ALIGNMENT
getAlignmentX
. Specifies an
alignment to the right side of the component.
protected Component()
Component
can be
extended directly to create a lightweight component that does not
utilize an opaque native window. A lightweight component must be
hosted by a native container somewhere higher up in the component
tree (for example, by a Frame
object).
public String getName()
public void setName(String name)
name
- The string that is to be this
component's name.
public Container getParent()
public ComponentPeer getPeer()
public final Object getTreeLock()
public Toolkit getToolkit()
public boolean isValid()
true
if the component is valid; false
otherwise.
public boolean isVisible()
Frame
objects.
true
if the component is visible;
false
otherwise.
public boolean isShowing()
true
if the component is showing;
false
otherwise.
public boolean isEnabled()
setEnabled
method.
true
if the component is enabled;
false
otherwise.
public void setEnabled(boolean b)
b
. An enabled component can respond to user
input and generate events. Components are enabled initially by default.
b
- If true
, this component is
enabled; otherwise this component is disabled.
public void enable()
setEnabled(boolean)
.
public void enable(boolean b)
setEnabled(boolean)
.
public void disable()
setEnabled(boolean)
.
public void setVisible(boolean b)
b
.
b
- If true
, shows this component;
otherwise, hides this component.
public void show()
setVisible(boolean)
.
public void show(boolean b)
setVisible(boolean)
.
public void hide()
setVisible(boolean)
.
public Color getForeground()
public void setForeground(Color c)
c
- The color to become this component's
foreground color.
public Color getBackground()
public void setBackground(Color c)
c
- The color to become this component's
background color.
public Font getFont()
public synchronized void setFont(Font f)
f
- The font to become this component's font.
public Locale getLocale()
public void setLocale(Locale l)
l
- The locale to become this component's locale.
public ColorModel getColorModel()
ColorModel
used to display
the component on the output device.
public Point getLocation()
Point
representing
the top-left corner of the component's bounds in the coordinate
space of the component's parent.
public Point getLocationOnScreen()
Point
representing
the top-left corner of the component's bounds in the
coordinate space of the screen.
public Point location()
getLocation()
.
public void setLocation(int x, int y)
x
and y
parameters in the coordinate space of this component's parent.
x
- The x-coordinate of the new location's
top-left corner in the parent's coordinate space.
y
- The y-coordinate of the new location's
top-left corner in the parent's coordinate space.
public void move(int x, int y)
setLocation(int, int)
.
public void setLocation(Point p)
p
. Point
p
is given in the parent's coordinate space.
p
- The point defining the top-left corner
of the new location, given in the coordinate space of this
component's parent.
public Dimension getSize()
Dimension
object. The height
field of the Dimension
object contains
this component's height, and the width
field of the Dimension
object contains
this component's width.
Dimension
object that indicates the
size of this component.
public Dimension size()
getSize()
.
public void setSize(int width, int height)
width
and height
.
width
- The new width of this component in pixels.
height
- The new height of this component in pixels.
public void resize(int width, int height)
setSize(int, int)
.
public void setSize(Dimension d)
d.width
and height d.height
.
d
- The dimension specifying the new size
of this component.
public void resize(Dimension d)
setSize(Dimension)
.
public Rectangle getBounds()
Rectangle
object. The bounds specify this
component's width, height, and location relative to
its parent.
public Rectangle bounds()
getBounds()
.
public void setBounds(int x, int y, int width, int height)
x
and y
, and the
new size is specified by width
and height
.
x
- The new x-coordinate of this component.
y
- The new y-coordinate of this component.
width
- The new width
of this component.
height
- The new height
of this
component.
public void reshape(int x, int y, int width, int height)
setBounds(int, int, int, int)
.
public void setBounds(Rectangle r)
r
. This component's new
position is specified by r.x
and r.y
,
and its new size is specified by r.width
and
r.height
r - The new bounding rectangle for this component.
See Also:
getBounds, setLocation, setLocation, setSize, setSize
getPreferredSize
public Dimension getPreferredSize()
- Gets the preferred size of this component.
- Returns:
- A dimension object indicating this component's preferred size.
- See Also:
- getMinimumSize, LayoutManager
preferredSize
public Dimension preferredSize()
- Note: preferredSize() is deprecated.
As of JDK version 1.1,
replaced by
getPreferredSize()
.
getMinimumSize
public Dimension getMinimumSize()
- Gets the mininimum size of this component.
- Returns:
- A dimension object indicating this component's minimum size.
- See Also:
- getPreferredSize, awtLayoutManager
minimumSize
public Dimension minimumSize()
- Note: minimumSize() is deprecated.
As of JDK version 1.1,
replaced by
getMinimumSize()
.
getMaximumSize
public Dimension getMaximumSize()
- Gets the maximum size of this component.
- Returns:
- A dimension object indicating this component's maximum size.
- See Also:
- getMinimumSize, getPreferredSize, LayoutManager
getAlignmentX
public float getAlignmentX()
- Returns the alignment along the x axis. This specifies how
the component would like to be aligned relative to other
components. The value should be a number between 0 and 1
where 0 represents alignment along the origin, 1 is aligned
the furthest away from the origin, 0.5 is centered, etc.
getAlignmentY
public float getAlignmentY()
- Returns the alignment along the y axis. This specifies how
the component would like to be aligned relative to other
components. The value should be a number between 0 and 1
where 0 represents alignment along the origin, 1 is aligned
the furthest away from the origin, 0.5 is centered, etc.
doLayout
public void doLayout()
- Prompts the layout manager to lay out this component. This is
usually called when the component (more specifically, container)
is validated.
- See Also:
- validate, LayoutManager
layout
public void layout()
- Note: layout() is deprecated.
As of JDK version 1.1,
replaced by
doLayout()
.
validate
public void validate()
- Ensures that this component has a valid layout. This method is
primarily intended to operate on instances of
Container
.
- See Also:
- invalidate, doLayout, LayoutManager, validate
invalidate
public void invalidate()
- Invalidates this component. This component and all parents
above it are marked as needing to be laid out. This method can
be called often, so it needs to execute quickly.
- See Also:
- validate, doLayout, LayoutManager
getGraphics
public Graphics getGraphics()
- Creates a graphics context for this component. This method will
return
null
if this component is currently not on
the screen.
- Returns:
- A graphics context for this component, or
null
if it has none.
- See Also:
- paint
getFontMetrics
public FontMetrics getFontMetrics(Font font)
- Gets the font metrics for the specified font.
- Parameters:
-
font
- The font for which font metrics is to be
obtained.
- font - the font.
- Returns:
- The font metrics for
font
.
- See Also:
- getFont, getPeer, getFontMetrics, getFontMetrics
setCursor
public synchronized void setCursor(Cursor cursor)
- Set the cursor image to a predefined cursor.
- Parameters:
-
cursor
- One of the constants defined
by the Cursor
class.
- See Also:
- getCursor, Cursor
getCursor
public Cursor getCursor()
- Gets the cursor set on this component.
- Returns:
- The cursor for this component.
- See Also:
- setCursor, Cursor
paint
public void paint(Graphics g)
- Paints this component. This method is called when the contents
of the component should be painted in response to the component
first being shown or damage needing repair. The clip rectangle
in the Graphics parameter will be set to the area which needs
to be painted.
- Parameters:
-
g
- The graphics context to use for painting.
- See Also:
- update
update
public void update(Graphics g)
- Updates this component.
The AWT calls the update
method in response to a
call to repaintupdate
or paint
. You can assume that
the background is not cleared.
The update
method of Component
does the following:
- Clears this component by filling it
with the background color.
- Sets the color of the graphics context to be
the foreground color of this component.
- Calls this component's
paint
method to completely redraw this component.
The origin of the graphics context, its
(0
, 0
) coordinate point, is the
top-left corner of this component. The clipping region of the
graphics context is the bounding rectangle of this component.
- Parameters:
- g - the specified context to use for updating.
- See Also:
- paint, repaint
paintAll
public void paintAll(Graphics g)
- Paints this component and all of its subcomponents.
The origin of the graphics context, its
(0
, 0
) coordinate point, is the
top-left corner of this component. The clipping region of the
graphics context is the bounding rectangle of this component.
- Parameters:
- g - the graphics context to use for painting.
- See Also:
- paint
repaint
public void repaint()
- Repaints this component.
This method causes a call to this component's update
method as soon as possible.
- See Also:
- update
repaint
public void repaint(long tm)
- Repaints the component. This will result in a
call to
update
within tm milliseconds.
- Parameters:
- tm - maximum time in milliseconds before update
- See Also:
- paint, update
repaint
public void repaint(int x,
int y,
int width,
int height)
- Repaints the specified rectangle of this component.
This method causes a call to this component's update
method as soon as possible.
- Parameters:
- x - the x coordinate.
- y - the y coordinate.
- width - the width.
- height - the height.
- See Also:
- update
repaint
public void repaint(long tm,
int x,
int y,
int width,
int height)
- Repaints the specified rectangle of this component within
tm
milliseconds.
This method causes a call to this component's
update
method.
- Parameters:
- tm - maximum time in milliseconds before update.
- x - the x coordinate.
- y - the y coordinate.
- width - the width.
- height - the height.
- See Also:
- update
print
public void print(Graphics g)
- Prints this component. Applications should override this method
for components that must do special processing before being
printed or should be printed differently than they are painted.
The default implementation of this method calls the
paint
method.
The origin of the graphics context, its
(0
, 0
) coordinate point, is the
top-left corner of this component. The clipping region of the
graphics context is the bounding rectangle of this component.
- Parameters:
- g - the graphics context to use for printing.
- See Also:
- paint
printAll
public void printAll(Graphics g)
- Prints this component and all of its subcomponents.
The origin of the graphics context, its
(0
, 0
) coordinate point, is the
top-left corner of this component. The clipping region of the
graphics context is the bounding rectangle of this component.
- Parameters:
- g - the graphics context to use for printing.
- See Also:
- print
imageUpdate
public boolean imageUpdate(Image img,
int flags,
int x,
int y,
int w,
int h)
- Repaints the component when the image has changed.
This
imageUpdate
method of an ImageObserver
is called when more information about an
image which had been previously requested using an asynchronous
routine such as the drawImage
method of
Graphics
becomes available.
See the definition of imageUpdate
for
more information on this method and its arguments.
The imageUpdate
method of Component
incrementally draws an image on the component as more of the bits
of the image are available.
If the system property awt.image.incrementalDraw
is missing or has the value true
, the image is
incrementally drawn, If the system property has any other value,
then the image is not drawn until it has been completely loaded.
Also, if incremental drawing is in effect, the value of the
system property awt.image.redrawrate
is interpreted
as an integer to give the maximum redraw rate, in milliseconds. If
the system property is missing or cannot be interpreted as an
integer, the redraw rate is once every 100ms.
The interpretation of the x
, y
,
width
, and height
arguments depends on
the value of the infoflags
argument.
- Parameters:
- img - the image being observed.
- infoflags - see
imageUpdate
for more information.
- x - the x coordinate.
- y - the y coordinate.
- width - the width.
- height - the height.
- Returns:
-
true
if the flags indicate that the
image is completely loaded;
false
otherwise.
- See Also:
- ImageObserver, drawImage, drawImage, drawImage, drawImage, imageUpdate
createImage
public Image createImage(ImageProducer producer)
- Creates an image from the specified image producer.
- Parameters:
- producer - the image producer
- Returns:
- the image produced.
createImage
public Image createImage(int width,
int height)
- Creates an off-screen drawable image
to be used for double buffering.
- Parameters:
- width - the specified width.
- height - the specified height.
- Returns:
- an off-screen drawable image,
which can be used for double buffering.
prepareImage
public boolean prepareImage(Image image,
ImageObserver observer)
- Prepares an image for rendering on this component. The image
data is downloaded asynchronously in another thread and the
appropriate screen representation of the image is generated.
- Parameters:
- image - the
Image
for which to
prepare a screen representation.
- observer - the
ImageObserver
object
to be notified as the image is being prepared.
- Returns:
-
true
if the image has already been fully prepared;
false
otherwise.
prepareImage
public boolean prepareImage(Image image,
int width,
int height,
ImageObserver observer)
- Prepares an image for rendering on this component at the
specified width and height.
The image data is downloaded asynchronously in another thread,
and an appropriately scaled screen representation of the image is
generated.
- Parameters:
- image - the instance of
Image
for which to prepare a screen representation.
- width - the width of the desired screen representation.
- height - the height of the desired screen representation.
- observer - the
ImageObserver
object
to be notified as the image is being prepared.
- Returns:
-
true
if the image has already been fully prepared;
false
otherwise.
- See Also:
- ImageObserver
checkImage
public int checkImage(Image image,
ImageObserver observer)
- Returns the status of the construction of a screen representation
of the specified image.
This method does not cause the image to begin loading. An
application must use the prepareImage
method
to force the loading of an image.
Information on the flags returned by this method can be found
with the discussion of the ImageObserver
interface.
- Parameters:
- image - the
Image
object whose status
is being checked.
- observer - the
ImageObserver
object to be notified as the image is being prepared.
- Returns:
- the bitwise inclusive OR of
ImageObserver
flags indicating what
information about the image is currently available.
- See Also:
- prepareImage, checkImage, ImageObserver
checkImage
public int checkImage(Image image,
int width,
int height,
ImageObserver observer)
- Returns the status of the construction of a screen representation
of the specified image.
This method does not cause the image to begin loading. An
application must use the prepareImage
method
to force the loading of an image.
The checkImage
method of Component
calls its peer's checkImage
method to calculate
the flags. If this component does not yet have a peer, the
component's toolkit's checkImage
method is called
instead.
Information on the flags returned by this method can be found
with the discussion of the ImageObserver
interface.
- Parameters:
- image - the
Image
object whose status
is being checked.
- width - the width of the scaled version
whose status is to be checked.
- height - the height of the scaled version
whose status is to be checked.
- observer - the
ImageObserver
object
to be notified as the image is being prepared.
- Returns:
- the bitwise inclusive OR of
ImageObserver
flags indicating what
information about the image is currently available.
- See Also:
- prepareImage, checkImage, _top_
contains
public boolean contains(int x,
int y)
- Checks whether this component "contains" the specified point,
where
x
and y
are defined to be
relative to the coordinate system of this component.
- Parameters:
- x - the x coordinate of the point.
- y - the y coordinate of the point.
- See Also:
- getComponentAt
inside
public boolean inside(int x,
int y)
- Note: inside() is deprecated.
As of JDK version 1.1,
replaced by contains(int, int).
contains
public boolean contains(Point p)
- Checks whether this component "contains" the specified point,
where the point's x and y coordinates are defined
to be relative to the coordinate system of this component.
- Parameters:
- p - the point.
- See Also:
- getComponentAt
getComponentAt
public Component getComponentAt(int x,
int y)
- Determines if this component or one of its immediate
subcomponents contains the (x, y) location,
and if so, returns the containing component. This method only
looks one level deep. If the point (x, y) is
inside a subcomponent that itself has subcomponents, it does not
go looking down the subcomponent tree.
The locate
method of Component
simply
returns the component itself if the (x, y)
coordinate location is inside its bounding box, and null
otherwise.
- Parameters:
- x - the x coordinate.
- y - the y coordinate.
- Returns:
- the component or subcomponent that contains the
(x, y) location;
null
if the location
is outside this component.
- See Also:
- contains
locate
public Component locate(int x,
int y)
- Note: locate() is deprecated.
As of JDK version 1.1,
replaced by getComponentAt(int, int).
getComponentAt
public Component getComponentAt(Point p)
- Returns the component or subcomponent that contains the
specified point.
- Parameters:
- p - the point.
- See Also:
- contains
deliverEvent
public void deliverEvent(Event e)
- Note: deliverEvent() is deprecated.
As of JDK version 1.1,
replaced by
dispatchEvent(AWTEvent e)
.
dispatchEvent
public final void dispatchEvent(AWTEvent e)
- Dispatches an event to this component or one of its sub components.
- Parameters:
- e - the event
postEvent
public boolean postEvent(Event e)
- Note: postEvent() is deprecated.
As of JDK version 1.1,
replaced by dispatchEvent(AWTEvent).
addComponentListener
public synchronized void addComponentListener(ComponentListener l)
- Adds the specified component listener to receive component events from
this component.
- Parameters:
- l - the component listener.
- See Also:
- ComponentEvent, ComponentListener, removeComponentListener
removeComponentListener
public synchronized void removeComponentListener(ComponentListener l)
- Removes the specified component listener so that it no longer
receives component events from this component.
- Parameters:
- l - the component listener.
- See Also:
- ComponentEvent, ComponentListener, addComponentListener
addFocusListener
public synchronized void addFocusListener(FocusListener l)
- Adds the specified focus listener to receive focus events from
this component.
- Parameters:
- l - the focus listener.
- See Also:
- FocusEvent, FocusListener, removeFocusListener
removeFocusListener
public synchronized void removeFocusListener(FocusListener l)
- Removes the specified focus listener so that it no longer
receives focus events from this component.
- Parameters:
- l - the focus listener.
- See Also:
- FocusEvent, FocusListener, addFocusListener
addKeyListener
public synchronized void addKeyListener(KeyListener l)
- Adds the specified key listener to receive key events from
this component.
- Parameters:
- l - the key listener.
- See Also:
- KeyEvent, KeyListener, removeKeyListener
removeKeyListener
public synchronized void removeKeyListener(KeyListener l)
- Removes the specified key listener so that it no longer
receives key events from this component.
- Parameters:
- l - the key listener.
- See Also:
- KeyEvent, KeyListener, addKeyListener
addMouseListener
public synchronized void addMouseListener(MouseListener l)
- Adds the specified mouse listener to receive mouse events from
this component.
- Parameters:
- l - the mouse listener.
- See Also:
- MouseEvent, MouseListener, removeMouseListener
removeMouseListener
public synchronized void removeMouseListener(MouseListener l)
- Removes the specified mouse listener so that it no longer
receives mouse events from this component.
- Parameters:
- l - the mouse listener.
- See Also:
- MouseEvent, MouseListener, addMouseListener
addMouseMotionListener
public synchronized void addMouseMotionListener(MouseMotionListener l)
- Adds the specified mouse motion listener to receive mouse motion events from
this component.
- Parameters:
- l - the mouse motion listener.
- See Also:
- MouseMotionEvent, MouseMotionListener, removeMouseMotionListener
removeMouseMotionListener
public synchronized void removeMouseMotionListener(MouseMotionListener l)
- Removes the specified mouse motion listener so that it no longer
receives mouse motion events from this component.
- Parameters:
- l - the mouse motion listener.
- See Also:
- MouseMotionEvent, MouseMotionListener, addMouseMotionListener
enableEvents
protected final void enableEvents(long eventsToEnable)
- Enables the events defined by the specified event mask parameter
to be delivered to this component.
Event types are automatically enabled when a listener for
that event type is added to the component.
This method only needs to be invoked by subclasses of
Component
which desire to have the specified event
types delivered to processEvent
regardless of whether
or not a listener is registered.
- Parameters:
- eventsToEnable - the event mask defining the event types.
- See Also:
- processEvent, disableEvents
disableEvents
protected final void disableEvents(long eventsToDisable)
- Disables the events defined by the specified event mask parameter
from being delivered to this component.
- Parameters:
- eventsToDisable - the event mask defining the event types
- See Also:
- enableEvents
processEvent
protected void processEvent(AWTEvent e)
- Processes events occurring on this component. By default this
method calls the appropriate
process<event type>Event
method for the given class of event.
- Parameters:
- e - the event.
- See Also:
- processComponentEvent, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent
processComponentEvent
protected void processComponentEvent(ComponentEvent e)
- Processes component events occurring on this component by
dispatching them to any registered
ComponentListener
objects.
This method is not called unless component events are
enabled for this component. Component events are enabled
when one of the following occurs:
- A
ComponentListener
object is registered
via addComponentListener
.
- Component events are enabled via
enableEvents
.
- Parameters:
- e - the component event.
- See Also:
- ComponentEvent, ComponentListener, addComponentListener, enableEvents
processFocusEvent
protected void processFocusEvent(FocusEvent e)
- Processes focus events occurring on this component by
dispatching them to any registered
FocusListener
objects.
This method is not called unless focus events are
enabled for this component. Focus events are enabled
when one of the following occurs:
- A
FocusListener
object is registered
via addFocusListener
.
- Focus events are enabled via
enableEvents
.
- Parameters:
- e - the focus event.
- See Also:
- FocusEvent, FocusListener, addFocusListener, enableEvents
processKeyEvent
protected void processKeyEvent(KeyEvent e)
- Processes key events occurring on this component by
dispatching them to any registered
objects.
This method is not called unless key events are
enabled for this component. Key events are enabled
when one of the following occurs:
- A
KeyListener
object is registered
via addKeyListener
.
- Key events are enabled via
enableEvents
.
- Parameters:
- e - the key event.
- See Also:
- KeyEvent, KeyListener, addKeyListener, enableEvents
processMouseEvent
protected void processMouseEvent(MouseEvent e)
- Processes mouse events occurring on this component by
dispatching them to any registered
MouseListener
objects.
This method is not called unless mouse events are
enabled for this component. Mouse events are enabled
when one of the following occurs:
- A
MouseListener
object is registered
via addMouseListener
.
- Mouse events are enabled via
enableEvents
.
- Parameters:
- e - the mouse event.
- See Also:
- MouseEvent, MouseListener, addMouseListener, enableEvents
processMouseMotionEvent
protected void processMouseMotionEvent(MouseEvent e)
- Processes mouse motion events occurring on this component by
dispatching them to any registered
MouseMotionListener
objects.
This method is not called unless mouse motion events are
enabled for this component. Mouse motion events are enabled
when one of the following occurs:
- A
MouseMotionListener
object is registered
via addMouseMotionListener
.
- Mouse motion events are enabled via
enableEvents
.
- Parameters:
- e - the mouse motion event.
- See Also:
- MouseMotionEvent, MouseMotionListener, addMouseMotionListener, enableEvents
handleEvent
public boolean handleEvent(Event evt)
- Note: handleEvent() is deprecated.
As of JDK version 1.1
replaced by processEvent(AWTEvent).
mouseDown
public boolean mouseDown(Event evt,
int x,
int y)
- Note: mouseDown() is deprecated.
As of JDK version 1.1,
replaced by processMouseEvent(MouseEvent).
mouseDrag
public boolean mouseDrag(Event evt,
int x,
int y)
- Note: mouseDrag() is deprecated.
As of JDK version 1.1,
replaced by processMouseMotionEvent(MouseEvent).
mouseUp
public boolean mouseUp(Event evt,
int x,
int y)
- Note: mouseUp() is deprecated.
As of JDK version 1.1,
replaced by processMouseEvent(MouseEvent).
mouseMove
public boolean mouseMove(Event evt,
int x,
int y)
- Note: mouseMove() is deprecated.
As of JDK version 1.1,
replaced by processMouseMotionEvent(MouseEvent).
mouseEnter
public boolean mouseEnter(Event evt,
int x,
int y)
- Note: mouseEnter() is deprecated.
As of JDK version 1.1,
replaced by processMouseEvent(MouseEvent).
mouseExit
public boolean mouseExit(Event evt,
int x,
int y)
- Note: mouseExit() is deprecated.
As of JDK version 1.1,
replaced by processMouseEvent(MouseEvent).
keyDown
public boolean keyDown(Event evt,
int key)
- Note: keyDown() is deprecated.
As of JDK version 1.1,
replaced by processKeyEvent(KeyEvent).
keyUp
public boolean keyUp(Event evt,
int key)
- Note: keyUp() is deprecated.
As of JDK version 1.1,
replaced by processKeyEvent(KeyEvent).
action
public boolean action(Event evt,
Object what)
- Note: action() is deprecated.
As of JDK version 1.1,
should register this component as ActionListener on component
which fires action events.
addNotify
public void addNotify()
- Notifies this component that it has been added to a container
and if a peer is required, it should be created.
This method should be called by
Container.add
, and
not by user code directly.
- See Also:
- removeNotify
removeNotify
public void removeNotify()
- Notifies this component that it has been removed from its
container and if a peers exists, it destroys it.
This method should be called by
Container.remove
,
and not by user code directly.
- See Also:
- addNotify
gotFocus
public boolean gotFocus(Event evt,
Object what)
- Note: gotFocus() is deprecated.
As of JDK version 1.1,
replaced by processFocusEvent(FocusEvent).
lostFocus
public boolean lostFocus(Event evt,
Object what)
- Note: lostFocus() is deprecated.
As of JDK version 1.1,
replaced by processFocusEvent(FocusEvent).
isFocusTraversable
public boolean isFocusTraversable()
- Returns the value of a flag that indicates whether
this component can be traversed using
Tab or Shift-Tab keyboard focus traversal. If this method
returns "false", this component may still request the keyboard
focus using
requestFocus()
, but it will not automatically
be assigned focus during tab traversal.
- Returns:
-
true
if this component is
focus-traverable; false
otherwise.
requestFocus
public void requestFocus()
- Requests that this component get the input focus.
This component's gotFocus
method is called when this
method is successful. The component must be visible
on the screen for this request to be granted
- See Also:
- FocusEvent, addFocusListener, processFocusEvent, isFocusTraversable
transferFocus
public void transferFocus()
- Transfers the focus to the next component.
- See Also:
- requestFocus, gotFocus
nextFocus
public void nextFocus()
- Note: nextFocus() is deprecated.
As of JDK version 1.1,
replaced by transferFocus().
add
public synchronized void add(PopupMenu popup)
- Adds the specified popup menu to the component.
- Parameters:
- popup - the popup menu to be added to the component.
- See Also:
- remove
remove
public synchronized void remove(MenuComponent popup)
- Removes the specified popup menu from the component.
- Parameters:
- popup - the popup menu to be removed.
- See Also:
- add
paramString
protected String paramString()
- Returns the parameter string representing the state of this
component. This string is useful for debugging.
- Returns:
- the parameter string of this component.
toString
public String toString()
- Returns a string representation of this component and its values.
- Returns:
- a string representation of this component.
- Overrides:
- toString in class Object
list
public void list()
- Prints a listing of this component to the standard system output
stream
System.out
.
- See Also:
- out
list
public void list(PrintStream out)
- Prints a listing of this component to the specified output
stream.
- Parameters:
- out - a print stream.
list
public void list(PrintStream out,
int indent)
- Prints out a list, starting at the specified indention, to the
specified print stream.
- Parameters:
- out - a print stream.
- indent - number of spaces to indent.
- See Also:
- println
list
public void list(PrintWriter out)
- Prints a listing to the specified print writer.
- Parameters:
- out - The print writer to print to.
list
public void list(PrintWriter out,
int indent)
- Prints out a list, starting at the specified indention, to
the specified print writer.
- Parameters:
- out - The print writer to print to.
- indent - The number of spaces to indent.
- See Also:
- println
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature